// 消除魔法字符串

// ES5
// function getArea(shape) {
//   let area = 0;
//   switch (shape) {
//     case "Triangle":
//       area = 1;
//       break;
//     case "Circle":
//       area = 2;
//       break;
//   }
//   return area;
// }
// console.log(getArea("Triangle"));

// ES6
const shapeType = {
  triangle: Symbol(),
  circle: Symbol(),
};
function getArea(shape) {
  let area = 0;
  switch (shape) {
    case shapeType.triangle:
      area = 1;
      break;
    case shapeType.circle:
      area = 2;
      break;
  }
  return area;
}
console.log(getArea(shapeType.triangle));
